import { createRouter, createWebHistory } from 'vue-router'
import System from '../views/Dashboard/System.vue'
import { Location } from "@element-plus/icons-vue"
import { shallowRef} from "vue"
// import HomeView from '../views/HomeView.vue'


const Dashiboard=[// 模块一
  {
    path:'system',
    name:"System",
    meta:{
      title:"系统介绍"
    },
    component:()=>import('../views/Dashboard/System.vue')
  },
  {
    path:'adddoods',
    name:"AddDoods",
    meta:{
      title:"添加商品"
    },
    component:()=>import('../views/Dashboard/AddDoods.vue')
  },
  {
    path:'dashboard',
    name:"Dashboard",
    meta:{
      title:"大盘数据"
    },
    component:()=>import('../views/Dashboard/Dashboard.vue')
  },
]
const indexpeizhi=[// 模块二
  {
    path:'loopimg',
    name:"loopimg",
    meta:{
      title:"轮播图"
    },
    component:()=>import('../views/indexpeizhi/loopimg.vue')
  },
  {
    path:'hotgoods',
    name:"hotgoods",
    meta:{
      title:"热销商品配置"
    },
    component:()=>import('../views/indexpeizhi/hotgoods.vue')
  },
  {
    path:'newgoods',
    name:"newgoods",
    
    meta:{
      title:"新品上线配置",
      
    },
    component:()=>import('../views/indexpeizhi/newgoods.vue')
  },
  {
    path:'recommend',
    name:"recommend",
    meta:{
      title:"新品上线配置"
    },
    component:()=>import('../views/indexpeizhi/recommend.vue')
  },
  
]
const module=[// 模块三
  {
    path:'classify',
    name:"classify",
    meta:{
      title:"分类管理"
    },
    component:()=>import('../views/module/classify.vue')
  },
  {
    path:'goods',
    name:"goods",
    meta:{
      title:"商品管理"
    },
    component:()=>import('../views/module/goods.vue')
  },
  {
    path:'vip',
    name:"vip",
    meta:{
      title:'会员管理'
    },
    component:()=>import('../views/module/vip.vue')
  },
  {
    path:'order',
    name:"order",
    meta:{
      title:'订单管理'
    },
    component:()=>import('../views/module/order.vue')
  },
  {
    path:'orderdetail',
    name:"Orderdetail",
    meta:{
      title:'订单详情'
    },
    component:()=>import('../views/module/Orderdetail.vue')
  },

  
  
]
const system=[
  {
    path:'code',
    name:"code",
    meta:{
      title:"修改密码"
    },
    component:()=>import('../views/system/code.vue')
  }
]


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect:'/login'
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('../views/Login.vue')
    },
    {
      path: '/index',
      redirect:"/index/system",
      name: 'Index',
      component: () => import('../views/Index.vue'),
      children:[
        ...Dashiboard,
        ...indexpeizhi,
        ...module,
        ...system
      ]
    },
    {
     path: '/:pathMatch(.*)*', 
    name: 'NotFound', 
    component: ()=>import('../views/NotFound.vue')
   },
  ]
})

export default router
